//
//  ListDetailsTableViewCell.m
//  项目A --半糖
//
//  Created by romana on 16/5/25.
//  Copyright © 2016年 romana. All rights reserved.
//

#import "ListDetailsTableViewCell.h"
#import "UIImageView+WebCache.h"

@implementation ListDetailsTableViewCell


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{

    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self doSomething];
    }

    return  self;

}

-(void)doSomething{

    self.bigImageView = [[UIImageView alloc] init];
    self.bigImageView.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:self.bigImageView];
    
    self.TitleLabel = [[UILabel alloc] init];
    self.TitleLabel.backgroundColor = [UIColor whiteColor];
    self.TitleLabel.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:self.TitleLabel];
    
    self.likesLabel = [[UILabel alloc] init];
    self.likesLabel.backgroundColor = [UIColor whiteColor];
  //  self.likesLabel.textAlignment = NSTextAlignmentCenter;

    [self.contentView addSubview:self.likesLabel];
    
    self.smallImageV = [[UIImageView alloc] init];
    self.smallImageV.backgroundColor = [UIColor whiteColor];
        self.smallImageV.image = [UIImage imageNamed:@"heart"];
    [self.contentView addSubview:self.smallImageV];





}

-(void)layoutSubviews{

    self.bigImageView.frame = CGRectMake(0, 0, self.frame.size.width, 230);
    self.TitleLabel.frame = CGRectMake(0, 230, self.frame.size.width, 30);
    self.likesLabel.frame = CGRectMake(self.frame.size.width / 2 - 10, 260, 100, 30);
    self.smallImageV.frame = CGRectMake(self.likesLabel.frame.origin.x - 30, 265, 20, 20);


}

-(void)setModel:(ListDetailsVCModel *)Model{

    _Model = Model;
    
    self.TitleLabel.text = _Model.title;
    self.likesLabel.text = _Model.likes;
    [self.bigImageView sd_setImageWithURL:[NSURL URLWithString:_Model.pic]];


}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
